package com.langyiquan.front.config;

import com.langyiquan.service.ResourceService;
import com.langyiquan.service.impl.AliOssResourceImpl;
import com.langyiquan.service.impl.DiskResourceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ResourceConfiguration {

    @Bean
    @ConditionalOnProperty(name = "resources.type", havingValue = "oss")
    public ResourceService aliOssResourceImpl(){
        return new AliOssResourceImpl();
    }

    @Bean
    @ConditionalOnProperty(name = "resources.type", havingValue = "disk")
    public ResourceService diskResourceImpl(){
        return new DiskResourceImpl();
    }

}
